package com.hdd.biz.app.controller;


import com.hdd.biz.app.dto.*;
import com.hdd.biz.app.service.PublishService;
import com.hdd.biz.finance.dto.PaymetListRequest;
import com.hdd.dto.SuperResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/app/publish")
@Api(value = "小程序-发布作品",tags = {"小程序-发布作品"})
public class PublishController {

    @Autowired
    private PublishService publishService;

    @PostMapping("/")
    @ApiOperation(value = "发布作品" ,notes = "")
    public AppResponse publish(@Valid @RequestBody PublishRequest request ) throws Exception{
        return publishService.publish(request);
    }

    @PostMapping("/update")
    @ApiOperation(value = "重新裱框" ,notes = "")
    public AppResponse update(@Valid @RequestBody PublishRequest request ) throws Exception{
        return publishService.update(request);
    }

    @PostMapping("/saveOriginalPicture")
    @ApiOperation(value = "保存原图" ,notes = "")
    public AppResponse saveOriginalPicture(@Valid @RequestBody SaveOriginalPictureRequest request ){
        return publishService.saveOriginalPicture(request);
    }

    @PostMapping("/uploadVoice")
    @ApiOperation(value = "上传语音" ,notes = "")
    public AppResponse uploadVoice(@Valid @RequestBody PaymetListRequest request ){
        return publishService.uploadVoice(request);
    }

    @PostMapping("/getFraming")
    @ApiOperation(value = "获取裱框" ,notes = "")
    public AppResponse getFraming(@Valid @RequestBody FramingRequest request ){
        return publishService.getFraming(request);
    }

    @PostMapping("/getColor")
    @ApiOperation(value = "获取颜色" ,notes = "")
    public AppResponse getColor(@Valid @RequestBody FramingRequest request ){
        return publishService.getColor(request);
    }

    @PostMapping("/getTopic")
    @ApiOperation(value = "获取话题列表" ,notes = "")
    public AppResponse getTopics(@Valid @RequestBody TopicsRequest request ){
        return publishService.getTopics(request);
    }

    @PostMapping("/getPriorTopic")
    @ApiOperation(value = "获取推荐话题" ,notes = "")
    public AppResponse getPriorTopic(@Valid @RequestBody TopicsRequest request ){
        return publishService.getPriorTopic(request);
    }

    @PostMapping("/addTopic")
    @ApiOperation(value = "添加话题" ,notes = "")
    public AppResponse addTopic(@Valid @RequestBody TopicsRequest request ){
        return publishService.addTopic(request);
    }


    @PostMapping("/addTopicForUpdate")
    @ApiOperation(value = "添加话题(修改)" ,notes = "")
    public AppResponse addTopicForUpdate(@Valid @RequestBody TopicsRequest request ){
        return publishService.addTopicForUpdate(request);
    }




    @PostMapping("/delTopic")
    @ApiOperation(value = "删除话题" ,notes = "")
    public AppResponse delTopic(@Valid @RequestBody TopicsRequest request ){
        return publishService.delTopic(request);
    }

}
